<?php

class Model{
    private $host = "localhost";
    private $user = "root";
    private $passwd = "root";
    private $database = "site-bar";
    protected $db_connect=null;
    
    function connection(){
        if($this->db_connect==null){
            $this->db_connect = mysql_connect($this->host, $this->user, $this->passwd);
            mysql_select_db($this->database);
        }
        mysql_query("SET NAMES UTF8");
        return $this->db_connect;
    }
    
    function disconnect(){
        mysql_close();
        $this->db_connect=null;
    }
}
?>
